// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) 

package com.imsl.finance;

import java.util.GregorianCalendar;

// Referenced classes of package com.imsl.finance:
//            BasisPart

class BasisPartActual
    implements BasisPart
{

    BasisPartActual()
    {
    }

    public int daysBetween(GregorianCalendar gregoriancalendar, GregorianCalendar gregoriancalendar1)
    {
        int i = gregoriancalendar.get(5);
        int j = gregoriancalendar.get(2);
        int k = gregoriancalendar.get(1);
        int l = gregoriancalendar1.get(5);
        int i1 = gregoriancalendar1.get(2);
        int j1 = gregoriancalendar1.get(1);
        return getNumDays(l, i1, j1) - getNumDays(i, j, k);
    }

    public int getDaysInYear(GregorianCalendar gregoriancalendar, GregorianCalendar gregoriancalendar1)
    {
        int i;
        boolean flag;
        boolean flag1;
label0:
        {
label1:
            {
                GregorianCalendar gregoriancalendar2 = (GregorianCalendar)gregoriancalendar1.clone();
                GregorianCalendar _tmp = gregoriancalendar1;
                gregoriancalendar2.add(1, -1);
                i = daysBetween(gregoriancalendar2, gregoriancalendar1);
                GregorianCalendar gregoriancalendar3 = gregoriancalendar;
                GregorianCalendar _tmp1 = gregoriancalendar3;
                int j = gregoriancalendar.get(1);
                GregorianCalendar _tmp2 = gregoriancalendar3;
                int k = gregoriancalendar1.get(1);
                GregorianCalendar _tmp3 = gregoriancalendar3;
                int l = gregoriancalendar.get(2);
                flag = j != k;
                if(gregoriancalendar3.isLeapYear(k))
                {
                    GregorianCalendar _tmp4 = gregoriancalendar3;
                    if(l <= 1)
                        break label1;
                }
                flag1 = true;
                break label0;
            }
            flag1 = false;
        }
        if(flag || flag1)
            i = 365;
        return i;
    }

    public double daysInPeriod(GregorianCalendar gregoriancalendar, int i)
    {
        int j = 12 / i;
        GregorianCalendar gregoriancalendar1 = (GregorianCalendar)gregoriancalendar.clone();
        gregoriancalendar1.add(2, -j);
        return (double)daysBetween(gregoriancalendar1, gregoriancalendar);
    }

    static int getNumDays(int i, int j, int k)
    {
        int l;
        int i1;
        if(j <= 1)
        {
            l = 0;
            i1 = k - 1;
        } else
        {
            l = (int)(0.40000000000000002D * (double)j + 2.7000000000000002D);
            i1 = k;
        }
        int j1 = (i1 / 4 - i1 / 100) + i1 / 400;
        return (365 * k + 31 * j + i + j1) - l;
    }
}
